home *** CD-ROM | disk | FTP | other *** search
- Path: EU.net!sun4nl!xs4all!usenet
- From: snrwo1@xs4all.nl (Rene Wonnink)
- Newsgroups: comp.lang.c
- Subject: removing a patricia tree from memory currupts heap?
- Date: Sun, 17 Mar 1996 08:03:40 GMT
- Organization: XS4ALL, networking for the masses
- Message-ID: <4igh11$ka6@news.xs4all.nl>
- NNTP-Posting-Host: ztm02-02.dial.xs4all.nl
- X-Newsreader: Forte Free Agent v0.55
-
- Hi there, I've made a program that uses a patricia tree (sort of radix sort
- tree) and that works fine. But I want to remove the tree from memory and
- start all over again with new data. When doing this the program stops
- running, i.e. it loops. When finding where that happend I found that it was
- in the statement:
-
- head->key = new char[8192];
-
- So the heap must have been corrupted, during cleaning-up of the tree, which
- was done with this small, recursive, procedure:
-
- void ruimTreeOp( PNODE * p )
- {
- if ( p->bitcount > p->left->bitcount )
- ruimTreeOp(p->left);
- delete p->key; // key is pointer to a char string
- if ( p->bitcount > p->right->bitcount )
- ruimTreeOp(p->right);
- delete p; // the node itself
- }
-
-
- I'm not seeing what I'm doing wrong here. Anybody?
- Groeten, Greetings, Salutations,
- Rene Wonnink
- snrwo1@xs4all.nl
- http://www.xs4all.nl/~snrwo1
-
-